package com.frogs.ucenter.v1.request;

import javax.servlet.http.HttpServletRequest;

import com.frogs.framework.web.HttpRequestInfo;
import com.frogs.system.util.ApiUrlParamEnum;
import com.frogs.system.web.api.request.Request;
import com.frogs.system.web.exception.RequestIllegalException;

public class LifeWayMergeRequest extends Request{

	private static final long serialVersionUID = -3134849608401118896L;

	private Integer id;
	private Integer userId;
	private Integer sportRate;
	private Integer smoking;
	private Integer drinkWine;
	private Integer drinkWater;
	private Integer eatFruit;
	private Integer eatVegetable;
	private Integer eatRoughage;
	private Integer taste;
	private Integer mealRule;
	private String riseTime;
	private String sleepTime;
	private Integer noonBreak;
	
	@Override
	public void parse(HttpServletRequest request) {
		HttpRequestInfo requestInfo = new HttpRequestInfo(request);
		this.id = requestInfo.getIntParameter(ApiUrlParamEnum.id.getParamName(), 0);
		this.userId = requestInfo.getIntParameter(ApiUrlParamEnum.userId.getParamName(), 0);
		this.sportRate = requestInfo.getIntParameter(ApiUrlParamEnum.lifeWaySportRate.getParamName(), 0);
		this.smoking = requestInfo.getIntParameter(ApiUrlParamEnum.lifeWaySmoking.getParamName(), 0);
		this.drinkWine = requestInfo.getIntParameter(ApiUrlParamEnum.lifeWayDrinkWine.getParamName(), 0);
		this.drinkWater = requestInfo.getIntParameter(ApiUrlParamEnum.lifeWayDrinkWater.getParamName(), 0);
		this.eatFruit = requestInfo.getIntParameter(ApiUrlParamEnum.lifeWayEatFruit.getParamName(), 0);
		this.eatVegetable = requestInfo.getIntParameter(ApiUrlParamEnum.lifeWayEatVegetable.getParamName(), 0);
		this.eatRoughage = requestInfo.getIntParameter(ApiUrlParamEnum.lifeWayEatRoughage.getParamName(), 0);
		this.taste = requestInfo.getIntParameter(ApiUrlParamEnum.lifeWayTaste.getParamName(), 0);
		this.mealRule = requestInfo.getIntParameter(ApiUrlParamEnum.lifeWayMealRule.getParamName(), 0);
		this.riseTime = requestInfo.getParameter(ApiUrlParamEnum.lifeWayRiseTime.getParamName(), "");
		this.sleepTime = requestInfo.getParameter(ApiUrlParamEnum.lifeWaySleepTime.getParamName(), "");
		this.noonBreak = requestInfo.getIntParameter(ApiUrlParamEnum.lifeWayNoonBreak.getParamName(), 0);
		
		if(userId < 1){
			throw new RequestIllegalException("error userId: " + userId);
		}
		
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getUserId() {
		return userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	public Integer getSportRate() {
		return sportRate;
	}

	public void setSportRate(Integer sportRate) {
		this.sportRate = sportRate;
	}

	public Integer getSmoking() {
		return smoking;
	}

	public void setSmoking(Integer smoking) {
		this.smoking = smoking;
	}

	public Integer getDrinkWine() {
		return drinkWine;
	}

	public void setDrinkWine(Integer drinkWine) {
		this.drinkWine = drinkWine;
	}

	public Integer getDrinkWater() {
		return drinkWater;
	}

	public void setDrinkWater(Integer drinkWater) {
		this.drinkWater = drinkWater;
	}

	public Integer getEatFruit() {
		return eatFruit;
	}

	public void setEatFruit(Integer eatFruit) {
		this.eatFruit = eatFruit;
	}

	public Integer getEatVegetable() {
		return eatVegetable;
	}

	public void setEatVegetable(Integer eatVegetable) {
		this.eatVegetable = eatVegetable;
	}

	public Integer getEatRoughage() {
		return eatRoughage;
	}

	public void setEatRoughage(Integer eatRoughage) {
		this.eatRoughage = eatRoughage;
	}

	public Integer getTaste() {
		return taste;
	}

	public void setTaste(Integer taste) {
		this.taste = taste;
	}

	public Integer getMealRule() {
		return mealRule;
	}

	public void setMealRule(Integer mealRule) {
		this.mealRule = mealRule;
	}

	public String getRiseTime() {
		return riseTime;
	}

	public void setRiseTime(String riseTime) {
		this.riseTime = riseTime;
	}

	public String getSleepTime() {
		return sleepTime;
	}

	public void setSleepTime(String sleepTime) {
		this.sleepTime = sleepTime;
	}

	public Integer getNoonBreak() {
		return noonBreak;
	}

	public void setNoonBreak(Integer noonBreak) {
		this.noonBreak = noonBreak;
	}

}
